import Mock from 'mockjs'

// 查询课程条目列表
export const getCourseItemPage = async (params: CourseItem): Promise<ListCourseItemRes> => {
  const res = await Mock.mock({
    'list|10': [
      {
        'id|+1': 1,
        itemName: '@cname',
        itemDesc: '@cword(3, 5)',
        'courseType|1': [1, 2, 3, 4],
        'itemStatus|1': [1, 2],
        'isFree|1': [true, false],
        sortNo: '@integer(0, 100)',
        createTime: 1691727146870
      }
    ],
    total: 100,
    pageNo: 1,
    pageSize: 10
  })
  return res
}

// 查询课程条目详情
export const getCourse = async (id: number) => {
  const res = await Mock.mock({
    'id|+1': 1,
    itemName: '@cname',
    itemDesc: '@cword(3, 5)',
    'courseType|1': [1, 2, 3, 4],
    'itemStatus|1': true,
    'isFree|1': '@boolean',
    sortNo: '@integer(0, 100)',
    createTime: 1691727146870
  })
  return res
}

// 修改课程条目
export const updateCourse = async (data: CourseItem): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

// 删除课程
export const deleteCourse = async (id: number): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}
